package postpc.powerreminders.com.ui.activities;

import postpc.powerreminders.com.events.RotgEventManager;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TabHost;

/*
 * 
 */
public class MainActivity extends TabActivity {
 
	private static final String TAG = "ROTG";

	/*
	 * Reference to the event Manager.
	 */
	RotgEventManager eventManager;

	/**
	 * On main activity creation.
	 */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(postpc.powerreminders.com.R.layout.main);
		
		/*
		 * Start the Event Manager
		 */
		this.eventManager = new RotgEventManager(this);


		TabHost tabHost = this.getTabHost();
		TabHost.TabSpec spec;
		Intent intent;

		// Reminders Tab
		intent = new Intent().setClass(this, RemindersActivity.class);
		spec = tabHost.newTabSpec("remindersTab").setIndicator("Reminders").setContent(intent);
		tabHost.addTab(spec);

		// Locations Tab
		intent = new Intent().setClass(this, LocationsActivity.class);
		spec = tabHost.newTabSpec("locationsTab").setIndicator("Locations").setContent(intent);
		tabHost.addTab(spec);
	}

	@Override
	public void onResume(){
		super.onResume();
		Log.i(TAG, "Main activity resumed");
	}

	@Override
	public void onStop(){
		super.onStop();
		Log.i(TAG, "Main activity stopped");
	}

	@Override
	public void onDestroy(){
		Log.i(TAG, "DESTROING applications");
		super.onDestroy();
		this.eventManager.onDestroy();
	}
}